package 第三题;

/**
 * @author A18ccms A18ccms_gmail_com
 * @version V1.0
 * @Title:
 * @Package
 * @Description: (用一句话描述该文件做什么)
 * @date
 */

public class ClimbThread implements Runnable {
    private  int time;//爬100米时间
    public int num;//爬多少个100米

    public ClimbThread(int time, int kilometer) {
        this.time = time;
        this.num = kilometer*1000/100;
    }

    @Override
    public void run() {
        while(num>0){
            try{
                Thread.sleep(this.time);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"爬完100米！");
            num--;
        }
        System.out.println(Thread.currentThread().getName()+"到达终点！");
    }
}
